Lập trình hàm Scala (ngôn ngữ lập trình)

Scala hỗ trợ lập trình hàm. Nó hỗ trợ cú pháp ngắn gọn cho việc định nghĩa các hàm, cho phép hàm lồng vào nhau. Dùng từ khóa lazy để trì hoãn sử dụng một biến cho đến khi cần sử dụng nó.Scala hỗ trợ các kiểu dữ liệu đại số của lập trình hàm.

Thuật toán sắp xếp theo kiểu lập trình hàm:

def qsort: List[Int] => List[Int] = {  case Nil => Nil  case pivot:: tail =>    val (smaller, rest) = tail.partition(_ < pivot)    qsort(smaller)::: pivot:: qsort(rest)}

Tài liệu tham khảo

WikiPedia: Scala (ngôn ngữ lập trình) http://lampwww.epfl.ch/~odersky/talks/google06.pdf http://www.apress.com/book/view/9781430219897/ http://www.artima.com/shop/programming_in_scala http://www.artima.com/weblogs/viewpost.jsp?thread=... http://www.carlobonamico.com/scala.php http://www.codecommit.com/blog/scala/roundup-scala... http://github.com/leithaus/XTrace/blob/monadic/src... http://code.google.com/p/scalacheck/ http://code.google.com/p/scalaz/ http://code.google.com/p/specs/